import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;


public class NGuessNumberTest {

    @Test
    public void generateAnswerTest(){
        int[] nums = NGuessNumber.generateAnswer();
        Assert.assertEquals("数字错误",nums.length,4);
        Arrays.sort(nums);
        Assert.assertEquals("最大值错误",nums[3] < 9 ? true : false ,true);
        List<Integer> collect = Arrays.stream(nums).distinct().boxed().collect(Collectors.toList());
        Assert.assertEquals("存在重复",collect.size(),4);
    }

    @Test
    public void getPlayerInputTest(){
        int[] nums = NGuessNumber.getPlayerInput();
        Assert.assertEquals("数量错误",nums.length,4);
    }


    @Test
    public void compareGuessAnswerTest(){
        int[] a = {1,2,3,4};
        int[] b = {2,3,3,4};
        NGuessNumber.compareGuessAnswer(a,b);
    }


    @Test
    public void isWinTest(){
        int[] a = {1,2,3,4};
        int[] b = {1,2,3,4};
        System.out.println(NGuessNumber.isWin(NGuessNumber.compareGuessAnswer(a, b)));

    }

}
